/**
 * 
 */
package com.epcs.subGNuevosNegocios.eci.conexion;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLTimeoutException;

import com.epcs.subGNuevosNegocios.eci.exception.ConnectionOracleException;

import oracle.jdbc.pool.OracleDataSource;


/**
 * @author Nicolas Figueroa
 *
 */
public class ConexionOracle {

	public static Connection getConnection()
	{
		Connection connection = null;
		
		try{
			
			/*Se prepara el driver jdbc para ser utilizado.*/
			Class.forName("oracle.jdbc.OracleDriver");
			
			/*Se hace la conexion a la BD */
			//connection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","OWNECI", "OWNECIPW");
			connection = DriverManager.getConnection("jdbc:oracle:thin:@192.168.100.26:1521:orcl","OWNECI", "OWNECIPW");
			
		}catch(ClassNotFoundException e)
		{
			//System.out.print("Fallo en carga : " + e);
			throw new ConnectionOracleException("Error de driver de base de datos.");
		}catch (SQLTimeoutException e) {

			throw new ConnectionOracleException("Error de tiempo de espera de base de datos.");
		}
		catch(SQLException e)
		{
			//System.out.print("Fallo conexion: " + e);
			throw new ConnectionOracleException("Error de conexion de base de datos.");

		}
		
		return connection;
	}
}
